-
Notifications
You must be signed in to change notification settings - Fork 583
Fix multiple issues uncovered by test suites #641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1962,6 +1962,16 @@ func TokenToString(token ast.Kind) string { | |||
return tokenToText[token] | |||
} | |||
|
|||
func GetViableKeywordSuggestions() []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this the third open PR with this fix 😄
Most of the fixes here are trivial, but there was an interesting issue with the caching of |
Huh, which field did that? I had sliced off or cleared everything, I thought... |
@@ -11521,7 +11533,10 @@ func (c *Checker) checkBinaryLikeExpression(left *ast.Node, operatorToken *ast.N | |||
ast.KindGreaterThanGreaterThanGreaterThanEqualsToken: | |||
rhsEval := c.evaluate(right, right) | |||
if numValue, ok := rhsEval.Value.(jsnum.Number); ok && numValue.Abs() >= 32 { | |||
c.errorOrSuggestion(ast.IsEnumMember(ast.WalkUpParenthesizedExpressions(right.Parent.Parent)), errorNode, diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2, scanner.GetTextOfNode(left), scanner.TokenToString(operator), (numValue / 32).Floor()) | |||
// Adding 0 removes sign from -0 | |||
shiftMod32 := math.Mod(float64(numValue), 32) + 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just numValue.Remainder(32)
? I'd rather not rely on the math
package outside of jsnum
; I eliminated it everywhere except for the max int consts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll switch to Number.Remainder
. Which by the way has a bug in it that I'll also fix.
r.c = c | ||
r := c.freeRelater | ||
if r == nil { | ||
r = &Relater{c: c} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I feel like we should probably clean this up into a plain sync pool, but, not in this PR.
Here's how it went wrong with the old logic: In the first call to Yeah, we should switch to a sync pool, but seems like overkill when sync isn't needed. |
No description provided.